//
//  TDC.h
//  
//
//  Created by Kun Zhao on 13/02/20.
//  Copyright (c) 2013 Kyoto University. All rights reserved.
//

#ifndef _TDC_h
#define _TDC_h

#include <iostream>
#include <kvs/Vector3>
#include <kvs/ValueArray>
#include <kvs/BitArray>

namespace kun
{
    
    class TDC
    {
        size_t m_block_size;
        kvs::Vector3ui m_resolution;
        kvs::BitArray m_vertex_table;
        kvs::ValueArray<float> m_values;
        //    float* m_values;
        
        size_t calculate_vertex_number( void );
        size_t calculate_tdc_vertex_number( void );
        
        size_t m_nnodes;  // vertex number for SDC
        size_t m_tdc_nnodes;  // vertex number for TDC
        
    public:
        
        TDC( void );
        
        TDC( std::string filename );
        
        TDC( size_t block_size, kvs::Vector3ui resolution, kvs::BitArray vertex_table, kvs::ValueArray<float> values );
        
        void setBlockSize( size_t block_size );
        
        void setResolution( kvs::Vector3ui resolution );
        
        void setVertexTable( kvs::BitArray vertex_table );
        
        void setValues( kvs::ValueArray<float> values );
        
        size_t blockSize( void );
        
        kvs::Vector3ui resolution( void );
        
        kvs::BitArray vertexTable( void );
        
        kvs::ValueArray<float> values( void ); 
        
        void read( std::string filename );
        
        void write( std::string filename );
    };
    
} // end of namespace of kun

#endif
